1. Field of the Invention
The invention relates to memory modules, and more particularly to wear-leveling of memory modules.
2. Description of the Related Art
A flash memory of a memory module is composed of a plurality of blocks capable of storing data. Because the number of the blocks of a flash memory is large, the blocks are divided into a plurality of groups for management convenience. Each group has a reduced number of blocks and is managed by a management unit. A flash memory therefore comprises a plurality of management units respectively managing a number of blocks of the flash memory.
Referring to FIG. 1, a block diagram of a computer system 100 is shown. The computer system 100 comprises a host 102 and a memory module 104 storing data of the host 102. The memory module 104 comprises a controller 112 and a flash memory 114. When the host 102 requests the memory module 104 to store data, the controller 112 receives data from the host 102 and stores data into the flash memory 114. When the host 102 requests the memory module 104 to retrieve data, the controller 112 retrieves data from the flash memory 114 and delivers data to the host 102. The flash memory 114 comprises a plurality of management units 121˜12N. Each of the management units 121˜12N manages a fixed number of blocks capable of storing data.
Before new data is stored to a block which has stored data therein, a controller 112 must erase the block in advance. Blocks of a flash memory therefore are erased again and again during the operating lifespan of the flash memory. Additionally, there is a limit as to the number of times a block of a flash memory can be erased, before operation is negatively effected. The controller of a memory module therefore must count the number of times a block of a flash memory is erased; the process is referred to as an erase count of the block. When a block with an erase count greater than a threshold is programmed with data, the block will not be accurately programmed and errors may occur in reading data from the block.
Thus, a controller must manage programming of the blocks of a flash memory by equally programming the blocks of a flash memory. A technique for equally programming blocks of a flash memory is referred to as “wear-leveling”. However, while blocks of a flash memory are respectively managed by a plurality of management units, conventional wear-leveling only equally program blocks of each management unit, separately. Thus, blocks of different management units will have different number of times of erasing. Specifically, some management units may have blocks with high erasing counts and other management units may have blocks with low erasing counts. Thus, a method for performing wear-leveling between different management units of a flash memory is required.